/* eslint valid-jsdoc: "off" */

'use strict';

const path = require('path');

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1643792764377_6135';

  config.sequelize = {
    dialect: 'mysql',
    host: '127.0.0.1',
    port: 3306,
    database: 'customer-service-database',
    username: 'root',
    password: '12345678',
  };

  config.jwt = {
    secret: 'zhangrunzhao',
  };

  config.security = {
    csrf: {
      enable: false,
    },
  };

  config.cors = {
    origin: '*',
    allowMethods: 'GET, HEAD, PUT, POST, DELETE, PATCH',
  };

  config.io = {
    init: {}, // passed to engine.io
    namespace: {
      '/': {
        connectionMiddleware: [ ],
        packetMiddleware: [], // 针对消息的处理暂时不实现
      },
      '/manager': {
        connectionMiddleware: [ ],
        packetMiddleware: [], // 针对消息的处理暂时不实现
      },
    },
  };

  config.multipart = {
    mode: 'stream',
  };

  // add your middleware config here
  config.middleware = [];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  config.uploadDir = 'app/public/image/upload';

  return {
    ...config,
    ...userConfig,
  };
};
